package com.geostar.constructionland.analyse.service.spatiaanalyst.impl;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.geostar.constructionland.analyse.entity.model.AnalyseModel;
import com.geostar.constructionland.analyse.service.spatiaanalyst.SptAlyParamService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * @author yelll
 * @since 2020-5-27 11:37
 * 通用分析
 **/
@Component
@Slf4j
public class  CommonSptAnalyse extends NormalSptAnalyst {
    @Autowired
    SptAlyParamService sptAlyParamService;
    @Override
    public Map<String, Object> getQueryParam(AnalyseModel analyseModel) throws Exception{
        /**确定接口参数构造类型**/
        Map<String,Object> requestInfo = sptAlyParamService.getCommonParam(analyseModel);
        Map<String,Object> param = new HashMap<>(1);
        try {
            param.put("requestInfo",objectMapper.writeValueAsString(requestInfo));
            log.info("requestInfo:"+objectMapper.writeValueAsString(requestInfo));
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return param;
    }
}
